#!/bin/sh

##
# Yaws HTTP Server
##

. /etc/rc.common

yaws=%prefix%/bin/yaws
lockdir=/var/spool/lock
yawsid=myserverid

StartService ()
{
    if [ "${YAWS:=-NO-}" = "-YES-" ]; then
	ConsoleMessage "Starting yaws http daemon"
	HOME=/tmp $yaws --id ${yawsid} --daemon --heart
	RETVAL=$?
	[ $RETVAL = 0 ]
    fi
}

StopService ()
{
    ConsoleMessage "Stopping yaws http daemon"
    HOME=/tmp $yaws --id ${yawsid} --stop
}

RestartService ()
{
    if [ "${YAWS:=-NO-}" = "-YES-" ]; then
	ConsoleMessage "Restarting yaws http daemon"
	HOME=/tmp $yaws --id ${yawsid} --hup
    else
	StopService
    fi
}

RunService "$1"
